package controllers

import (
	"github.com/astaxie/beego"
	"beeblog/models"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Get() {
	c.Data["IsHome"] = true
	c.Data["IsLogin"] = checkAccount(c.Ctx)
	var err error
	cate := c.Input().Get("cate")
	lable := c.Input().Get("lable")
	c.Data["Topics"] ,err = models.GetDecAllTopics(cate,lable)
	if err!= nil{
		beego.Error(err)
	}
	c.Data["Categories"],err = models.GetAllCategories()
	if err!= nil{
		beego.Error(err)
	}
	c.TplName = "home.html"
}
